package com.tiancheng.trade.settlement.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 对账状态
 */
@Getter
@AllArgsConstructor
public enum MateStatusEnum {

    MATE1("0", "已匹配"),
    MATE2("1", "有差异"),
    MATE3("2", "未匹配"),
    MATE4("3", "未匹配");

    private String code;
    private String desc;

    public static String getDesc(String code) {
        Optional<MateStatusEnum> found = Arrays.stream(MateStatusEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }
}
